package com.morizhang.merchanmanager.api.service;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.morizhang.merchanmanager.api.ApiResult;
import com.morizhang.merchanmanager.api.IService;
import com.morizhang.merchanmanager.api.model.statistics.IndexInfoModel;
import com.morizhang.merchanmanager.api.plugins.BasicStatistics;
import org.springframework.beans.factory.annotation.Autowired;

@ServiceAnnotation(name = "GetIndexInfoService")
public class GetIndexInfoService implements IService {
    @Autowired
    private BasicStatistics basicStatistics;

    @Override
    public ApiResult callService(JSONObject requestParams) throws Exception {
        IndexInfoModel indexInfo = basicStatistics.queryIndexInfo();
        ApiResult result = new ApiResult();
        result.setData(JSON.parseObject(JSON.toJSONString(indexInfo)));
        result.setSuccess(true);
        return result;
    }
}
